<%-------------------------------------------------------------------
 * 页面名称：returnTransList.jsp
 * 功能描述：申请退款交易查询
 * Action  : returnTransQuery.od
 *
 *-------------------------------------------------------------------
--%>
<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-tiles.tld" prefix="tiles"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-bean.tld" prefix="bean"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="ipb" uri="/WEB-INF/conf/tld/ipb.tld"%>
<%@ taglib prefix="ad" uri="agiledata"%>
<%@ page import="cn.agiledata.bank.common.util.Constant"%>
<%@ page import="cn.agiledata.bank.account.service.IAccountConst"%>
<%@ page import="cn.agiledata.bank.account.service.AccountSummary"%>
<%
	String path = request.getContextPath();
	AccountSummary user = (AccountSummary) session
			.getAttribute(Constant.SESSION_ACCOUNT_SUMMARY);
%>
<script language=javascript src="<%=path%>/js/popcalendar.js"></script>
<script language="javascript">
function initAdvanced(){
    var advancedCondition1 = document.getElementById("advancedCondition1");
    advancedCondition1.style.display = document.forms[0].showAdvanced.value;
    var advancedCondition2 = document.getElementById("advancedCondition2");
    advancedCondition2.style.display = document.forms[0].showAdvanced.value;
}
function searchIt(){
    var o =document.forms[0].all;
    for(var i=0;i<o.length;i++){
        var dis =o[i].style.display ;
        if(dis!="undefine"&&dis=="none"){
            o[i].style.display="block";
        }
        if(dis!="undefine"&&dis=="block"){
            o[i].style.display="none";
        }
    }
    if(document.forms[0].showAdvanced.value=="none"){
        document.forms[0].showAdvanced.value="block";
    }else{
        document.forms[0].showAdvanced.value="none";
    }
}
function id_keyup(txtinput){
    txtinput.value=txtinput.value.replace(/(^\s*)|(\s*$)/g, "");
}
function doSearch(){
	var beginDateObj = getObj('beginDate');
	if (beginDateObj.value!="") {
		if (!checkDateInput(beginDateObj)) {
			return;
		}
	}
	
	var endDateObj = getObj('endDate');
	if (endDateObj.value!="") {
		if (!checkDateInput(endDateObj)) {
			return;
		}
		if (beginDateObj.value!="") {
			if (compareDate(beginDateObj.value, endDateObj.value)<0) {
				alert("起始日期不能大于结束日期！");
				return;
			}
		}
	}
    var amountMin = getObj('minAmount').value;
    var amountMax = getObj('maxAmount').value;
    if(isNaN(amountMin)==true){
        alert("请输入数字！");
        getObj('minAmount').focus();
        getObj('minAmount').value="";
        return;
    }
    if(isNaN(amountMax)==true){
        alert("请输入数字！");
        getObj('maxAmount').focus();
        getObj('maxAmount').value="";
        return;
    }
    document.forms[0].submit();
}
function onBodyLoad(){
    initAdvanced();
}

	function returnApply() {
		// 退款申请
		var bolChecked = false;
		var objChecks = document.getElementsByName("checkId");
		for(var i = 0; i < objChecks.length; i++) {
			// 判断是否至少选中一条交易
			if(objChecks[i].checked == true) {
				bolChecked = true;
				break;
			}
		}

		if(bolChecked) {
			document.forms[0].action='returnApplyList.do';
			document.forms[0].submit();
		}
		else {
			alert("请至少选择一条交易！");
		}
	}
</script>
<html:form action="returnTransQuery" method="post">
	<logic:present parameter="showAdvanced">
		<bean:parameter id="showAdvanced" name="showAdvanced" />
		<input type="hidden" name="showAdvanced"
			value="<bean:write name="showAdvanced"/>">
	</logic:present>
	<logic:notPresent parameter="showAdvanced">
		<input type="hidden" name="showAdvanced" value="none">
	</logic:notPresent>
	<div id="main">
		<div class="content_right">
			<div style="width:745px;margin-left:10px;">
				<div class="titleinfo">
					申请退款交易查询
				</div>
				<div class="edit_pass">
					<table width="100%" border="0" align="center" cellpadding="3"
						cellspacing="1">
						<tr>
							<td class="font_blue" align="right">
								交易编号：
							</td>
							<td>
								<html:text styleClass="inputStyle" property="transId"
									onkeyup="id_keyup(this)" />
							</td>
							<td class="font_blue" align="right">
								订单编号：
							</td>
							<td>
								<html:text styleClass="inputStyle" property="orderId"
									onkeyup="id_keyup(this)" />
							</td>
						</tr>
						<tr>
							<td class="font_blue" align="right">
								交易日期：
							</td>
							<td nowrap>
								<ad:calendar property="beginDate" path="<%=path%>" />
								至
								<ad:calendar property="endDate" path="<%=path%>" />
							</td>
							<td class="font_blue" align="right">
								交易金额：
							</td>
							<td>
								<html:text styleClass="inputStyle" size="10"
									property="minAmount" onkeyup="id_keyup(this)" />
								至
								<html:text styleClass="inputStyle" size="10"
									property="maxAmount" onkeyup="id_keyup(this)" />
						</tr>
						<tr>
							<td colspan="4" align="center">
								<input type="button" value="查 询" class="graybutton_style"
									onclick="doSearch()" style="margin-right:10px;" />
							</td>
						</tr>
						<tr>
							<td colspan="4">
								<table width="100%" class="tablestyle">
									<tr>
										<th width="30"></th>
										<th>
											<span class="blue14">交易编号</span>
										</th>
										<th>
											<span class="blue14">订单编号</span>
										</th>
										<th>
											<span class="blue14">交易对方</span>
										</th>
										<th>
											<span class="blue14">交易类型</span>
										</th>
										<th>
											<span class="blue14">交易模式</span>
										</th>
										<th>
											<span class="blue14">交易状态</span>
										</th>
										<th>
											<span class="blue14">交易时间</span>
										</th>
										<th>
											<span class="blue14">金额</span>
										</th>
									</tr>
									<c:forEach var="trans" items="${result.data}"
										varStatus="status">
										<tr>
											<td>
												<input type="checkbox" style="border:0;" name="checkId"
													value="<bean:write name="trans" property="id" />" />
											</td>
											<td>
												<bean:write name="trans" property="transId" />
											</td>
											<td>
												<bean:write name="trans" property="orderId" />
											</td>
											<td>
												<!--  交易对方 -->
												<logic:equal name="trans" property="actionType.actionId"
													value="InnerTrans">
													<a
														href="<%=path%>/page/common/getAccount.do?accountId=<bean:write name="trans" property="debit.account.id"/>"><bean:write
															name="trans" property="debit.account.name" />
													</a>
												</logic:equal>
												<logic:equal name="trans" property="actionType.actionId"
													value="B2cNetPay">
													<ad:write typeid="BANK_INFO" name="trans"
														property="bankSeq" />
												</logic:equal>
											</td>
											<td>
												<bean:write name="trans" property="actionType.actionName" />
											</td>
											<td>
												<ad:write typeid="TRADE_TYPE" name="trans"
													property="tradeType" />
											</td>
											<td>
												<ad:write typeid="TRANS_STATUS" name="trans"
													property="transStatus" />
											</td>
											<td>
												<bean:write name="trans" format="yyyy-MM-dd HH:mm:ss"
													property="beginDate" />
											</td>

											<td>
												<bean:write name="trans" property="amount" />
												元
											</td>
										</tr>
									</c:forEach>
								</table>
								<table width="100%" border="0" cellspacing="0" cellpadding="0">
									<tr>
										<td class="font_blue">
											<ad:PageBean name="result" />
										</td>
									</tr>
								</table>
							</td>
						</tr>
					</table>
					<div class="button_Frame">
						<input type="button" value="申请退款" class="button_style"
							onClick="returnApply();" />
					</div>
				</div>
			</div>
		</div>
	</div>
</html:form>
